﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HomeAutomation
{
    class Command
    {
        public static Command on = new Command("on");
        public static Command off = new Command("off");
        private string name;

        private Command(string name)
        {
            this.name = name;
        }

        public static Command getCommand_throwsException(String description)
        {
            if (description.Contains("On"))
            {
                return on;
            }
            else if (description.Contains("Off"))
            {
                return off;
            }
            else
            {
                throw new System.Exception("Don't have a mapping for command: " + description);
            }
        }

        public override string ToString()
        {
            return "Command: " + name;
        }
    }
}
